import Util from './util'
import wepy from 'wepy'

export default (url = '', method = 'GET', params = {}) => {
  return new Promise((resolve,reject) => {
    wepy.request({
      url: Util.getRequestUrl(url),
      method: method,
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      data: params,
      success(res) {
        resolve(res)
      },
      fail(err){
        reject(err)
      }
    })
  })
}